<?php
namespace Home\Model;
use Think\Model\RelationModel;
class AlbumModel extends RelationModel{
     protected $_link = array(
             'Photo' => array(
                 'mapping_type'  => self::HAS_MANY,
                  'class_name'    => 'album_photo',
                  'foreign_key'   => 'album_id',
                  'mapping_name'  => 'photos',
                  'mapping_order' => 'ctime desc',
                  ),
             );
 }